﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace SiteUnion.Entities
{
   /// <summary>
   ///  会员实体对象
   /// </summary>
   public class AccountEntity
   {
      /// <summary>
      /// 用户角色标识
      /// </summary>
      public string RID;

      /// <summary>
      /// 用户昵称
      /// </summary>
      public string NickName = null;

      /// <summary>
      /// 加密后的密码
      /// </summary>
      internal string Password = null;

      /// <summary>
      /// 用户图标
      /// </summary>
      public string Icon = null;

      /// <summary>
      /// 用户性别
      /// </summary>
      public int Gender;

      /// <summary>
      /// 用户个人网页地址
      /// </summary>
      public string WWW;

      /// <summary>
      /// 用户注册时间
      /// </summary>
      public string Reg;
 
      /// <summary>
      /// 用户注册时的IP地址
      /// </summary>
      public string RegIP;

      /// <summary>
      /// 上次登陆时间
      /// </summary>
      public string LastLogin;

      /// <summary>
      /// 上次登录IP
      /// </summary>
      public string LastLoginIP;

      /// <summary>
      /// 登录次数
      /// </summary>
      public int logins;

      /// <summary>
      /// 人品值
      /// </summary>
      public int RenPin;

      /// <summary>
      /// 金钱数量
      /// </summary>
      public int money;

      /// <summary>
      /// 是否激活
      /// </summary>
      public bool IsActived;

      /// <summary>
      /// 激活码
      /// </summary>
      public string ActiveCode;

      public static bool IsAuthenticated
      {
         get
         {
            if (HttpContext.Current != null)
            {
               if (HttpContext.Current.Request.IsAuthenticated) return true;
            }

            return false;
         }
      }

      /// <summary>
      /// 是否是管理员
      /// </summary>
      public bool IsMaster
      {
         get
         {
            return (RID == RoleEntity.MASTER);
         }
      }

      /// <summary>
      /// 其他参数
      /// </summary>
      public string Params;
   }
}
